package com.ling;

import com.ling.pl.core.commons.springmvc.ResposeInfo;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by bo.wang on 2016/9/27.
 */
@ControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(value = Exception.class)
    @ResponseBody
    public ResposeInfo<String> jsonErrorHandler(HttpServletRequest req, Exception e) throws Exception {
        return ResposeInfo.buildException(e, req);
    }
}
